package pat;

import java.util.Scanner;
import java.util.Arrays;

public class B1019 {

    static void ArrayReverse(char[] inputchars) {
        char temp;
        for (int i = 0; i < inputchars.length / 2; i++) {
            temp = inputchars[i];
            inputchars[i] = inputchars[inputchars.length - i - 1];
            inputchars[inputchars.length - i - 1] = temp;
        }
    }

    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        String str = input.next();

        if (str.equals("6174")) {
            System.out.print("7641 - 1467 = 6174");
            return;
        }

        if (str.length() == 1) {
            str = "000" + String.valueOf(str);
        } else if (str.length() == 2) {
            str = "00" + String.valueOf(str);
        } else if (str.length() == 3) {
            str = "0" + String.valueOf(str);
        }

        while (!str.equals("6174")) {
            char[] minchars = str.toCharArray();
            Arrays.sort(minchars);
            String minstr = String.valueOf(minchars);
            int minint = Integer.parseInt(minstr);

            char[] maxchars = Arrays.copyOf(minchars, minchars.length);
            ArrayReverse(maxchars);
            String maxstr = String.valueOf(maxchars);
            int maxint = Integer.parseInt(maxstr);


            int next = maxint - minint;
            if (next == 0) {
                System.out.print(maxstr + " " + "-" + " " + minstr + " " + "=" + " 0000");
                break;
            } else if (next == 6174) {
                System.out.print(maxstr + " " + "-" + " " + minstr + " " + "=" + " " + next);
                str = String.valueOf(next);
            } else if (next < 1000) {
                if (next < 10) {
                    str = "000" + String.valueOf(next);
                } else if (next < 100) {
                    str = "00" + String.valueOf(next);
                } else {
                    str = "0" + String.valueOf(next);
                }
                System.out.println(maxstr + " " + "-" + " " + minstr + " " + "=" + " " + str);
            } else {
                System.out.println(maxstr + " " + "-" + " " + minstr + " " + "=" + " " + next);
                str = String.valueOf(next);
            }
        }
    }
}
